# -*- coding: utf-8 -*-
import os
env = os.environ
from mako.lookup import TemplateLookup
from mako import exceptions
root = "%s/"%os.path.join(env['PYMUQUE_HOME'])
lookup = TemplateLookup(directories=[root + 'templates'],output_encoding='utf-8', encoding_errors='replace', filesystem_checks=True, module_directory=root+ './lib/modules')
class basetemplates:
  def __init__(self,logger,mimetype="text/xml",encoding="utf-8"):
      self.mimetype=mimetype
      self.encoding=encoding
      self.logger=logger
      self.out=None
  def render(self):
    try:
      return self.out.encode(self.encoding)
    except:
      #todo gestire l'eccezzione
      return ""
  def clear(self):
    self.logger.debug("Clear %s"%__name__)
 